<script type="text/javascript">
//<![CDATA[
{literal}
var map;
	
function createMarker(point, number)
 {
 var marker = new GMarker(point);
 // Show this markers index in the info window when it is clicked
 var html = number;
 GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
 return marker;
 };



function onLoad() {
	map = new GMap2(document.getElementById("map"));
	//map = new GMap(document.getElementById("map"));
	//map.setMapType(_HYBRID_TYPE);
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	//map.setCenter(new GLatLng(58.960189, 5.613155), 12);
	map.setCenter(new GLatLng(58.897552, 5.675125), 12);

	
{/literal}
{section name=pointers loop=$incidents}
	{if $incidents[pointers].lat and $incidents[pointers].lon}
	    var point = new GLatLng({$incidents[pointers].lat}, {$incidents[pointers].lon});
	    var marker = new createMarker(point, '<div id="\infowindow\" style="\white-space: nowrap;\"><strong><a href="#">{$incidents[pointers].offense}</a></strong><br /><br />{$incidents[pointers].comment|escape}</div>');
	    map.addOverlay(marker);
        {/if}
{/section}
{literal}
}

/*function add_marker(lon, lat) {
	var point = new GPoint(lon, lat);
	var marker = new createMarker(point, '');	
	map.addOverlay(marker);

}*/
function center_map(lon, lat) {
	point = new GLatLng(lat, lon);
	map.setCenter(point);
	
}

//]]>
</script>
{/literal}
